import requestProxy from '@/utils/request';

const { request } = requestProxy;

export function getList(page, perPage, data, cancelToken) {
  return request({
    url: '/admin/order/list',
    method: 'get',
    params: {
      page,
      perPage,
      ...data
    },
    cancelToken
  });
}

export function getOrderList(params) {
  return request({
    url: '/admin/order/list',
    method: 'get',
    params
  });
}

// 删除订单
export function delOrder(id) {
  return request({
    url: `admin/order/${id}/delete`,
    method: 'delete'
  });
}

// 批量删除订单
export function batchDelOrder(data) {
  return request({
    url: 'admin/order/delete/batch',
    method: 'delete',
    data
  });
}

// 新增订单
export function addOrder(data) {
  return request({
    url: 'admin/order/create',
    method: 'post',
    data
  });
}
// 批量新增订单
export function createOrderBatch(data) {
  return request({
    url: 'admin/order/create/batch',
    method: 'post',
    data
  });
}

// 编辑订单
export function editOrder(id, data) {
  return request({
    url: `admin/order/${id}/edit`,
    method: 'put',
    data
  });
}

// 订单详情页
export function getOrderInfo(id) {
  return request({
    url: `admin/order/${id}/detail`,
    method: 'get'
  });
}
// 订单详情页
export function getOrderStatistics(params) {
  return request({
    url: 'admin/order/list/statistics',
    method: 'get',
    params
  });
}

// 获取自定义列
export function getOrderSetting() {
  return request({
    url: 'admin/order/list/diy',
    method: 'get'
  });
}

// 修改自定义列
export function editOrderSetting(data) {
  return request({
    url: 'admin/order/list/diy/edit',
    method: 'post',
    data
  });
}

// 获取订单上传记录列表
export function getUploadList(params) {
  return request({
    url: 'admin/order/uploadRecords',
    method: 'get',
    params
  });
}

export function batchUpdate(data) {
  return request({
    url: 'admin/orderOperator/update/batch',
    method: 'post',
    data
  });
}

export function batchPick(data) {
  return request({
    url: 'admin/order/list/batchPick',
    method: 'post',
    data
  });
}

export function publishOrder(data) {
  return request({
    url: 'admin/order/publish',
    method: 'post',
    data
  });
}
export function backOrder(data) {
  return request({
    url: 'admin/order/back',
    method: 'post',
    data
  });
}
export function submitCost(data) {
  return request({
    url: 'admin/order/submit/cost',
    method: 'post',
    data
  });
}
export function examineOrder(data) {
  return request({
    url: 'admin/order/examine',
    method: 'post',
    data
  });
}

export function changeTalent(data) {
  return request({
    url: 'admin/order/talent/edit/' + data.id,
    method: 'post',
    data
  });
}

// 订单操作记录
export function getOperateReports(params) {
  return request({
    url: 'admin/order/log',
    method: 'get',
    params
  });
}

// 修改操作记录备注
export function editLogRemark(data) {
  return request({
    url: 'admin/order/log/remarks',
    method: 'post',
    data
  });
}

export function recoveryOrder(data) {
  return request({
    url: 'admin/order/recovery',
    method: 'post',
    data
  });
}

// 渠道订单成本明细列表
export function costList(id, params) {
  return request({
    url: `admin/order/cost/list/${id}`,
    method: 'get',
    params
  });
}

// 渠道订单成本明细列表-关联成本
export function relatedCost(id, data) {
  return request({
    url: `admin/order/related/cost/${id}`,
    method: 'post',
    data
  });
}

// 渠道订单成本明细列表-关联成本
export function relatedInvoiceAndContract(data) {
  return request({
    url: 'admin/order/related/invoiceAndContract',
    method: 'post',
    data
  });
}
// 渠道订单-删除订单（回收站真删）
export function deleteOrder(params) {
  return request({
    url: 'admin/order/delete',
    method: 'delete',
    params
  });
}

export function getPublishData(params) {
  return request({
    url: 'admin/publish/data',
    method: 'get',
    params
  });
}

// 渠道订单 - 评分列表
export function getOrderScoreList(params) {
  return request({
    url: 'admin/order/score/list',
    method: 'get',
    params
  });
}

// 渠道订单 - 新增评分
export function addOrderScore(data) {
  return request({
    url: 'admin/order/score/add',
    method: 'post',
    data
  });
}

// 渠道订单 - 删除评分
export function deleteOrderScore(data) {
  return request({
    url: 'admin/order/score/deleted',
    method: 'delete',
    data
  });
}

// 渠道订单 - 修改评分
export function modifyOrderScore(data) {
  return request({
    url: 'admin/order/score/modify',
    method: 'post',
    data
  });
}

//
export function linkRequiredCheck(params) {
  return request({
    url: 'admin/order/linkReqiuredCheck',
    method: 'get',
    params
  });
}

// 关联询单
export function queryOrderRelated(data) {
  return request({
    url: '/admin/order/relatedQueryOrder',
    method: 'post',
    data
  });
}

// 取消关联询单
export function cancelOrderRelated(data) {
  return request({
    url: '/admin/order/cancelRelatedQueryOrder',
    method: 'delete',
    data
  });
}

export function createOrderView(data) {
  return request({
    url: '/admin/order/view/create',
    method: 'post',
    data
  });
}

export function editOrderView(data) {
  return request({
    url: '/admin/order/view/edit',
    method: 'put',
    data
  });
}

export function getOrderView(params) {
  return request({
    url: '/admin/order/view/list',
    method: 'get',
    params
  });
}

export function delOrderView(id) {
  return request({
    url: `/admin/order/view/delete/${id}`,
    method: 'delete'
  });
}
